/*
using MyGeneration/Template/NHibernate (c) by Sharp 1.4
based on OHM (alvy77@hotmail.com)
*/
using System;
using System.Collections;
using System.Collections.Generic;

namespace DomainModel
{

	/// <summary>
	/// IUserSave interface for NHibernate mapped table 'UserSave'.
	/// </summary>
	public interface IUserSave
	{
		#region Public Properties
		
		int us_id
		{
			get ;
			set ;
			  
		}
		
		int us_dlid
		{
			get ;
			set ;
			  
		}
		
		int us_lbid
		{
			get ;
			set ;
			  
		}
		
		DateTime us_time
		{
			get ;
			set ;
			  
		}
		
		bool IsDeleted { get; set; }
		bool IsChanged { get; set; }
		
		#endregion 
	}

	/// <summary>
	/// UserSave object for NHibernate mapped table 'UserSave'.
	/// </summary>
	[Serializable]
	public class UserSave : ICloneable,IUserSave
	{
		#region Member Variables

		protected int _us_id;
		protected int _us_dlid;
		protected int _us_lbid;
		protected DateTime _us_time;
		protected bool _bIsDeleted;
		protected bool _bIsChanged;
		#endregion
		
		#region Constructors
		public UserSave() {}
		
		public UserSave(int pusdlid, int puslbid, DateTime pustime)
		{
			this._us_dlid = pusdlid; 
			this._us_lbid = puslbid; 
			this._us_time = pustime; 
		}
		
		public UserSave(int pusid)
		{
			this._us_id = pusid; 
		}
		
		#endregion
		
		#region Public Properties
		
		public virtual int us_id
		{
			get { return _us_id; }
			set { _bIsChanged |= (_us_id != value); _us_id = value; }
			
		}
		
		public virtual int us_dlid
		{
			get { return _us_dlid; }
			set { _bIsChanged |= (_us_dlid != value); _us_dlid = value; }
			
		}
		
		public virtual int us_lbid
		{
			get { return _us_lbid; }
			set { _bIsChanged |= (_us_lbid != value); _us_lbid = value; }
			
		}
		
		public virtual DateTime us_time
		{
			get { return _us_time; }
			set { _bIsChanged |= (_us_time != value); _us_time = value; }
			
		}
		

		public virtual bool IsDeleted
		{
			get
			{
				return _bIsDeleted;
			}
			set
			{
				_bIsDeleted = value;
			}
		}
		
		public virtual bool IsChanged
		{
			get
			{
				return _bIsChanged;
			}
			set
			{
				_bIsChanged = value;
			}
		}
		
		#endregion 
		
		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			UserSave castObj = null;
			try
			{
				castObj = (UserSave)obj;
			} catch(Exception) { return false; } 
			return ( castObj != null ) &&
				( this._us_id == castObj.us_id );
		}
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
		  
			
			int hash = 57; 
			hash = 27 * hash * _us_id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region ICloneable methods
		
		public virtual object Clone()
		{
			return this.MemberwiseClone();
		}
		
		#endregion
	}
	
	#region Custom ICollection interface for UserSave 

	
	public interface IUserSaveCollection : ICollection
	{
		UserSave this[int index]{	get; set; }
		void Add(UserSave pUserSave);
		void Clear();
	}
	
	[Serializable]
	public class UserSaveCollection : IUserSaveCollection
	{
		private IList<UserSave> _arrayInternal;

		public UserSaveCollection()
		{
			_arrayInternal = new List<UserSave>();
		}
		
		public UserSaveCollection( IList<UserSave> pSource )
		{
			_arrayInternal = pSource;
			if(_arrayInternal == null)
			{
				_arrayInternal = new List<UserSave>();
			}
		}

		public UserSave this[int index]
		{
			get
			{
				return _arrayInternal[index];
			}
			set
			{
				_arrayInternal[index] = value;
			}
		}

		public int Count { get { return _arrayInternal.Count; } }
		public bool IsSynchronized { get { return false; } }
		public object SyncRoot { get { return _arrayInternal; } }
		public void CopyTo(Array array, int index){ _arrayInternal.CopyTo((UserSave[])array, index); }
		public IEnumerator GetEnumerator() { return _arrayInternal.GetEnumerator(); }
		public void Add(UserSave pUserSave) { _arrayInternal.Add(pUserSave); }
		public void Clear() { _arrayInternal.Clear(); }
		public IList<UserSave> GetList() { return _arrayInternal; }
	 }
	
	#endregion
}
